#ifndef _TASK_POOL_IMPL_H_
#define _TASK_POOL_IMPL_H_

#include "TaskPool.h"
#include "Thread.h"
#include "TaskQueueSync.h"
#include <vector>

typedef std::vector<Thread *> THREAD_VECTOR;
class TaskPoolImpl : 
	public TaskPool
{
public:
	static TaskPoolImpl * create(int32_t trd_cnt);
	virtual ~TaskPoolImpl();

protected:
	virtual bool set_task(Task *task);
	virtual bool get_stat(TaskPoolStat *stat);
	virtual bool complete();
	virtual void destroy();

protected:
	TaskPoolImpl();
	bool init(int32_t trd_cnt);
	void query_stat();

	int32_t thread_cnt_;
	TaskQueueSync *task_queue_;
	THREAD_VECTOR thread_vec_;
	TaskPoolStat stat_;
};
#endif